<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
    <c:set var="ctx" value="${pageContext.request.contextPath}" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>私海规则修改页</title>
    <jsp:include page="../../import.jsp" flush="true" />

</head>
<body class="iframeBody">
<div class="Wrapper">
    <form id="formSet1">
        <div class="fieldset1 tabel_col clearFix">
            <div class="fieldBox col_50">
                <div class="label">私海名称</div>
                <div class="field">
                    <input name="privateSeaNm" id="privateSeaNm" type="text" class="ui-textbox" validate="{required:true}">
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">所属事业部</div>
                <div class="field">
                    <input type="text" id="buOrgCd" name="buOrgCd"
                           ltype="combobox" validate="{required:true}"/><span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">是否支持私海领取</div>
                <div class="field">
                    <input id="isCanReceive_yes" type="radio" name="checkChange"
                           onchange="checkBoxChange();" <c:if test="${not empty splPriSeaRuleCfgVO.isCanReceive and splPriSeaRuleCfgVO.isCanReceive == 1 }"> checked </c:if> >
                    <span>是</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <input id="isCanReceive_no" type="radio" name="checkChange"
                           onchange="checkBoxChange();" <c:if test="${not empty splPriSeaRuleCfgVO.isCanReceive and splPriSeaRuleCfgVO.isCanReceive == 0 }"> checked </c:if> >
                    <span>否</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">私海领取上限</div>
                <div class="field">
                    <input type="text" id="receiveLimitUp" name="receiveLimitUp" class="ui-textbox"
                           validate="{required:true,number:true}"/>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">私海客户数限制</div>
                <div class="field">
                    <input type="text" id="customersLimitUp" name="customersLimitUp" class="ui-textbox"
                           validate="{required:true,number:true}"/>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">领取私海默认天数</div>
                <div class="field">
                    <input type="text" id="receiveDefaultDay" name="receiveDefaultDay" class="ui-textbox"
                           validate="{required:true,number:true}"/>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="sqPanel">
                <div class="fieldset1 tabel_col clearFix">
                    <div class="sqPanel_head inL">
                        <span>私海领取与释放</span>
                    </div>
                    <div class="sqPanel_body">
                        <div class="fieldBox col_100">
                            <div class="label">私海释放</div>
                            <div class="field">
                                <div class="allCheckBox">
                                    <input id="receivelimit" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.releasedReceiveDay and splPriSeaRuleCfgVO.releasedReceiveDay != -1 }"> checked </c:if> >
                                    <span>释放到公海的经销商，原私海客户经理</span>
                                        <input id="releasedReceiveDay" type="text" name="releasedReceiveDay"
                                        <c:if test="${empty splPriSeaRuleCfgVO.releasedReceiveDay or splPriSeaRuleCfgVO.releasedReceiveDay == -1}"> readonly </c:if>>
                                    <span>天内不允许认领</span><br/>
                                    <input id="manulrelease" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                            <c:if test="${not empty splPriSeaRuleCfgVO.isActiveRelease and splPriSeaRuleCfgVO.isActiveRelease == 1}"> checked </c:if>>
                                    <span>手动释放</span><br>
                                    <input id="autorelease" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.isAutoRelease and splPriSeaRuleCfgVO.isAutoRelease == 1}"> checked </c:if>>
                                    <span>自动释放</span>
                                    <%--<c:if test="${not empty splPriSeaRuleCfgVO.isAutoRelease and splPriSeaRuleCfgVO.isAutoRelease == 1}">--%>
                                        <div id="auto" style="text-indent: 2em;display: none">
                                            <ul>
                                                <li style="text-indent: 4em;">
                                                    <span>自动释放条件关系且/或：</span>
                                                    <input id="qc_yes" type="radio" name="qcChange" onchange="checkQCChange();"
                                                            <c:if test="${not empty splPriSeaRuleCfgVO.autoRuleQCAndIsOr and splPriSeaRuleCfgVO.autoRuleQCAndIsOr == 1}"> checked="checked" </c:if> />
                                                    <span>且</span>&nbsp;&nbsp;
                                                    <input id="qc_no" type="radio" name="qcChange" onchange="checkQCChange();"
                                                            <c:if test="${not empty splPriSeaRuleCfgVO.autoRuleQCAndIsOr and splPriSeaRuleCfgVO.autoRuleQCAndIsOr == 0}"> checked="checked"  </c:if> />
                                                    <span>或</span>&nbsp;&nbsp;
                                                    <span class="requiredSymbol">*</span>
                                                </li>
                                                <li>
                                                    <input id="releaseRule_1" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                                    <c:if test="${not empty splPriSeaRuleCfgVO.unvisitReleaseDay and splPriSeaRuleCfgVO.unvisitReleaseDay != -1}"> checked </c:if> />
                                                    <span>从认领日起，</span>
                                                    <input id="unvisitReleaseDay" type="text" name="unvisitReleaseDay"
                                                    <c:if test="${empty splPriSeaRuleCfgVO.unvisitReleaseDay  or splPriSeaRuleCfgVO.unvisitReleaseDay == -1}"> readonly</c:if> />
                                                    <span>个自然日未上门拜访的，作释放公海处理</span>
                                                </li>
                                                <li>
                                                    <input id="releaseRule_4" type="checkbox" name="checkChange"
                                                           onchange="checkBoxChange();" <c:if test="${not empty splPriSeaRuleCfgVO.uncrtprjReleaseDay and splPriSeaRuleCfgVO.uncrtprjReleaseDay != -1}"> checked </c:if>>
                                                    <span>从认领日起，</span>
                                                    <input id="uncrtprjReleaseDay" type="text" name="uncrtprjReleaseDay"
                                                    <c:if test="${empty splPriSeaRuleCfgVO.uncrtprjReleaseDay  or splPriSeaRuleCfgVO.uncrtprjReleaseDay == -1}"> readonly</c:if>>
                                                    <span>个自然日未立项的，作释放公海处理</span>
                                                </li>
                                                <li>
                                                    <input id="releaseRule_2" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                                    <c:if test="${not empty splPriSeaRuleCfgVO.uncapReleaseDay and splPriSeaRuleCfgVO.uncapReleaseDay != -1}"> checked </c:if> />
                                                    <span>认领期间，</span>
                                                    <input id="uncapReleaseDay" type="text" name="uncapReleaseDay" onchange="checkBoxChange();"
                                                            <c:if test="${empty splPriSeaRuleCfgVO.uncapReleaseDay or splPriSeaRuleCfgVO.uncapReleaseDay == -1}"> readonly</c:if> />
                                                    <span>个自然日未产生放款的，作释放公海处理</span>
                                                </li>
                                                <li>
                                                    <input id="releaseRule_3" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                                    <c:if test="${not empty splPriSeaRuleCfgVO.hadCapedReleaseDay and splPriSeaRuleCfgVO.hadCapedReleaseDay != -1}"> checked </c:if> />
                                                    <span>认领期间产生放款后，从放款之日起，</span>
                                                    <input id="hadCapedReleaseDay" type="text" name="hadCapedReleaseDay"
                                                    <c:if test="${empty splPriSeaRuleCfgVO.hadCapedReleaseDay or splPriSeaRuleCfgVO.hadCapedReleaseDay == -1}">readonly</c:if> />
                                                    <span>个自然日未再次产生放款的，作释放公海处理</span>
                                                </li>
                                            </ul>
                                        </div>
                                    <%--</c:if>--%>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="sqPanel_body">
                        <div class="fieldBox col_100">
                            <div class="label">私海领取</div>
                            <div class="field">
                                <div class="allCheckBox">
                                    <input id="receiveRule_1" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.capDelayDate and splPriSeaRuleCfgVO.capDelayDate != -1}"> checked </c:if> >
                                    <span>在私海期间，针对该客户经理有放款记录的将增加私海时长</span>
                                    <input id="capDelayDate" type="text" name="capDelayDate"
                                    <c:if test="${empty splPriSeaRuleCfgVO.capDelayDate or splPriSeaRuleCfgVO.capDelayDate == -1}">readonly</c:if> />
                                    <span>天</span><br/>
                                    <input id="receiveRule_2" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.crtPrjDelayDate and splPriSeaRuleCfgVO.crtPrjDelayDate != -1}"> checked </c:if> >
                                    <span>在私海期间，针对该客户经理有立项记录的将增加私海时长</span>
                                    <input id="crtPrjDelayDate" type="text" name="crtPrjDelayDate"
                                    <c:if test="${empty splPriSeaRuleCfgVO.crtPrjDelayDate or splPriSeaRuleCfgVO.crtPrjDelayDate == -1}"> readonly </c:if> />
                                    <span>天</span><br/>
                                    <input id="receiveRule_3" type="checkbox" name="checkChange" onchange="checkBoxChange();"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.visitRecDelayDate and splPriSeaRuleCfgVO.visitRecDelayDate != -1}"> checked </c:if> >
                                    <span>在私海期间，针对该客户经理有拜访的将增加私海时长</span>
                                    <input id="visitRecDelayDate" type="text" name="visitRecDelayDate"
                                            <c:if test="${empty splPriSeaRuleCfgVO.visitRecDelayDate or splPriSeaRuleCfgVO.visitRecDelayDate == -1}"> readonly </c:if> />
                                    <span>天</span><br/>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="sqPanel_body">
                        <div class="fieldBox col_100">
                            <div class="label">备注说明</div>
                            <div class="field">
                                <textarea name="remark" id="remark" rows="4" class="l-textarea" style="width:99%"></textarea>
                                <input name="priSeaId" id="priSeaId" type="hidden" value="${splPriSeaRuleCfgVO.id }">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>


<script type="text/javascript">
    var currBuOrgCd = '${currBuOrgCd}';
    var currOrgCd = '${currOrgCd}';
    var isAutoRelease ;
    var isActiveRelease ;
    var againReceiveLimit ;
    var formSet1;
    var vo = ${voJson};
    console.log("vo == "+ vo);
    var isCanReceive ;
    var autoRuleQCAndIsOr ;

    $(function () {
        var _buOrgCdListJSON = ${buOrgList};
        console.log("_buOrgCdListJSON" + JSON2.stringify(_buOrgCdListJSON));
        $("#buOrgCd").ligerComboBox({
            isShowCheckBox: true, isMultiSelect: false,
            data: _buOrgCdListJSON,
            valueField: 'key',
            textField: 'value',
            onChangeValue: function (value) {
                var _buOrg = liger.get("buOrgCd");
                var _buOrgCd = _buOrg.getValue();
            }
        });

        formSet1 = $('#formSet1').ligerForm({
            validate: true
        });
        console.log("vo.isAutoRelease == "+vo.isAutoRelease);
        if(vo && vo.isAutoRelease == '1'){
            console.log("vo.isAutoRelease == "+vo.isAutoRelease);
            $("#auto").css("display", "block");
        }
        isAutoRelease = vo.isAutoRelease ;
        isActiveRelease = vo.isActiveRelease ;
        if(vo && vo.releasedReceiveDay && vo.releasedReceiveDay != -1){
            againReceiveLimit = 1 ;
        }else{
            againReceiveLimit = 0 ;
        }
        initData();

    });


    function initData(){
        var id = $("#priSeaId").val();
        if(!id)return;
        var _url = '<%=path%>/spl/splprisearulecfg/getById.do';
        $.ajax({
            type: 'get',
            dataType:'json',
            data:{id:id},
            url: _url,
            success:function(msg){
                if(msg.success == 1){
                    setData(msg.data);//设置数据
                }else{
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //设置页面数据
    function setData(data){
        var form = liger.get("formSet1");
        $("#privateSeaNm").val(data.privateSeaNm);
        //$("#buOrgCd").val(data.buOrgCd);
        $("#remark").val(data.remark);
        if(data.customersLimitUp && data.customersLimitUp != -1){
            $("#customersLimitUp").val(data.customersLimitUp);
        }
        if(data.receiveDefaultDay && data.receiveDefaultDay != -1){
            $("#receiveDefaultDay").val(data.receiveDefaultDay);
        }
        if(data.releasedReceiveDay && data.releasedReceiveDay != -1){
            $("#releasedReceiveDay").val(data.releasedReceiveDay);
        }
        if(data.isAutoRelease && data.isAutoRelease == 1){
            // $("#unvisitReleaseDay").val(data.unvisitReleaseDay);
            // $("#uncapReleaseDay").val(data.uncapReleaseDay);
            // $("#capReleaseDay").val(data.capReleaseDay);
            if(data.unvisitReleaseDay && data.unvisitReleaseDay != -1){
                $("#unvisitReleaseDay").val(data.unvisitReleaseDay);
            }
            if(data.uncapReleaseDay && data.uncapReleaseDay != -1){
                $("#uncapReleaseDay").val(data.uncapReleaseDay);
            }
            if(data.hadCapedReleaseDay && data.hadCapedReleaseDay != -1){
                $("#hadCapedReleaseDay").val(data.hadCapedReleaseDay);
            }
            if(data.uncrtprjReleaseDay && data.uncrtprjReleaseDay != -1){
                $("#uncrtprjReleaseDay").val(data.uncrtprjReleaseDay);
            }
        }
        if(data.capDelayDate && data.capDelayDate != -1){
            $("#capDelayDate").val(data.capDelayDate);
        }
        if(data.crtPrjDelayDate && data.crtPrjDelayDate != -1){
            $("#crtPrjDelayDate").val(data.crtPrjDelayDate);
        }
        if(data.visitRecDelayDate && data.visitRecDelayDate != -1){
            $("#visitRecDelayDate").val(data.visitRecDelayDate);
        }
        if(data.receiveLimitUp && data.receiveLimitUp != -1){
            $("#receiveLimitUp").val(data.receiveLimitUp);
        }
        // $("#capDelayDate").val(data.capDelayDate);
        // $("#crtPrjDelayDate").val(data.crtPrjDelayDate);
        // $("#receiveLimitUp").val(data.receiveLimitUp);

        if(data.isCanReceive){
            isCanReceive = data.isCanReceive ;
        }
        if(data.autoRuleQCAndIsOr){
            autoRuleQCAndIsOr = data.autoRuleQCAndIsOr ;
        }
        $("#buOrgCd").ligerGetComboBoxManager().selectValue(data.buOrgCd);
        $("#buOrgCd").ligerGetComboBoxManager().updateStyle();

    };

    //定义父级调用事件
    frameElement.dialog.onOk = function () {
        save();
    }

    frameElement.dialog.onCancel = function () {
        frameElement.dialog.close();
    }

    function save() {
        var form = liger.get("formSet1");
        var checkBoxResult = checkReleaseReceiveSts();
        if (!checkBoxResult['isSuccess']) {
            $.ligerDialog.SQalert({content: checkBoxResult['info'], SQ_type: "warning"});
            return false;
        }
        if (!form.valid()) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        var data = form.getData();
        data["currBuOrgCd"] = currBuOrgCd;
        data["currOrgCd"] = currOrgCd;
        data["isAutoRelease"] = isAutoRelease;
        data["isActiveRelease"] = isActiveRelease;
        data["againReceiveLimit"] = againReceiveLimit;
        data["isCanReceive"] = isCanReceive;
        data["autoRuleQCAndIsOr"] = autoRuleQCAndIsOr ;
        data["id"] = $("#priSeaId").val();

        var url = '<%=path%>/spl/splprisearulecfg/modify.do';
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: data,
            url: url,
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    parent.callback();
                    frameElement.dialog.close();
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }


    //释放领取规则change
    function checkBoxChange() {
        var f = true;
        $("input[name='checkChange']").each(function () {
            if (!$(this)[0].checked) {
                f = false;//有任意一个未选中 f则被赋值为false
            }

            if ($(this)[0].id == "autorelease") {
                if ($("#autorelease")[0].checked) {
                    $("#auto").css("display", "block");
                } else {
                    $("#unvisitReleaseDay").val("");
                    $("#uncapReleaseDay").val("");
                    $("#hadCapedReleaseDay").val("");
                    $("#auto").css("display", "none");
                }
            }

            if ($(this)[0].id == "manulrelease") {
                if ($("#manulrelease")[0].checked) {
                    isActiveRelease = 1;
                } else {
                    isActiveRelease = 0;
                }
            }

            if ($(this)[0].id == "isCanReceive_yes") {
                if ($("#isCanReceive_yes")[0].checked) {
                    isCanReceive = 1;
                }
            }
            if ($(this)[0].id == "isCanReceive_no") {
                if ($("#isCanReceive_no")[0].checked) {
                    isCanReceive = 0;
                }
            }

            if ($(this)[0].id == "autorelease") {
                if ($("#autorelease")[0].checked) {
                    isAutoRelease = 1;
                } else {
                    isAutoRelease = 0;
                }
            }

            if ($(this)[0].id == "receivelimit") {
                if ($("#receivelimit")[0].checked) {
                    againReceiveLimit = 1;
                    //$("#releasedReceiveDay").removeAttr("readOnly");
                    $("#releasedReceiveDay").attr("readOnly", false);
                    formSet1.setFieldValidate("releasedReceiveDay", {
                        required: true,
                        number:true
                    });
                } else {
                    againReceiveLimit = 0;
                    $("#releasedReceiveDay").val("");
                    $("#releasedReceiveDay").attr("readOnly", true);
                    formSet1.setFieldValidate("releasedReceiveDay", {
                        required: false
                    });
                }
            }

            //限制天数是否可填写
            if ($(this)[0].id == "releaseRule_1") {
                if ($("#releaseRule_1")[0].checked) {
                    //$("#unvisitReleaseDay").removeAttr("readOnly");
                    $("#unvisitReleaseDay").attr("readOnly", false);
                    formSet1.setFieldValidate("unvisitReleaseDay", {
                        required: true,
                        number:true
                    });
                } else {
                    $("#unvisitReleaseDay").val("");
                    $("#unvisitReleaseDay").attr("readOnly", true);
                    formSet1.setFieldValidate("unvisitReleaseDay", {
                        required: false
                    });
                }
            }
            if ($(this)[0].id == "releaseRule_2") {
                if ($("#releaseRule_2")[0].checked) {
                    //$("#uncapReleaseDay").removeAttr("readOnly");
                    $("#uncapReleaseDay").attr("readOnly", false);
                    formSet1.setFieldValidate("uncapReleaseDay", {
                        required: true
                    });
                } else {
                    $("#uncapReleaseDay").val("");
                    $("#uncapReleaseDay").attr("readOnly", true);
                    formSet1.setFieldValidate("uncapReleaseDay", {
                        required: false
                    });
                }
            }
            if ($(this)[0].id == "releaseRule_4") {
                if ($("#releaseRule_4")[0].checked) {
                    //$("#uncapReleaseDay").removeAttr("readOnly");
                    $("#uncrtprjReleaseDay").attr("readOnly", false);
                    formSet1.setFieldValidate("uncrtprjReleaseDay", {
                        required: true,
                        number:true
                    });
                } else {
                    $("#uncrtprjReleaseDay").val("");
                    $("#uncrtprjReleaseDay").attr("readOnly", true);
                    formSet1.setFieldValidate("uncrtprjReleaseDay", {
                        required: false
                    });
                }
            }
            if ($(this)[0].id == "releaseRule_3") {
                if ($("#releaseRule_3")[0].checked) {
                    //$("#capReleaseDay").removeAttr("readOnly");
                    $("#hadCapedReleaseDay").attr("readOnly", false);
                    formSet1.setFieldValidate("hadCapedReleaseDay", {
                        required: true,
                        number:true
                    });
                } else {
                    $("#hadCapedReleaseDay").val("");
                    $("#hadCapedReleaseDay").attr("readOnly", true);
                    formSet1.setFieldValidate("hadCapedReleaseDay", {
                        required: false
                    });
                }
            }

            if ($(this)[0].id == "receiveRule_1") {
                if ($("#receiveRule_1")[0].checked) {
                    //$("#capDelayDate").removeAttr("readOnly");
                    $("#capDelayDate").attr("readOnly", false);
                    formSet1.setFieldValidate("capDelayDate", {
                        required: true,
                        number:true
                    });
                } else {
                    $("#capDelayDate").val("");
                    $("#capDelayDate").attr("readOnly", true);
                    formSet1.setFieldValidate("capDelayDate", {
                        required: false
                    });
                }
            }
            if ($(this)[0].id == "receiveRule_2") {
                if ($("#receiveRule_2")[0].checked) {
                    //$("#crtPrjDelayDate").removeAttr("readOnly");
                    $("#crtPrjDelayDate").attr("readOnly", false);
                    formSet1.setFieldValidate("crtPrjDelayDate", {
                        required: true,
                        number:true
                    });
                } else {
                    $("#crtPrjDelayDate").val("");
                    $("#crtPrjDelayDate").attr("readOnly", true);
                    formSet1.setFieldValidate("crtPrjDelayDate", {
                        required: false
                    });
                }
            }

            if ($(this)[0].id == "receiveRule_3") {
                if ($("#receiveRule_3")[0].checked) {
                    //$("#receiveDefaultDay").removeAttr("readOnly");
                    $("#visitRecDelayDate").attr("readOnly", false);
                    formSet1.setFieldValidate("visitRecDelayDate", {
                        required: true,
                        number:true
                    });
                } else {
                    $("#visitRecDelayDate").val("");
                    $("#visitRecDelayDate").attr("readOnly", true);
                    formSet1.setFieldValidate("visitRecDelayDate", {
                        required: false
                    });
                }
            }
        });

    }


    //释放领取规则change
    function checkReleaseReceiveSts() {
        var result = {"isSuccess":true,"info":"success"};
        $("input[name='checkChange']").each(function () {
            if ($(this)[0].checked) {
                if ($(this)[0].id == "releaseRule_1") {
                    if ($("#releaseRule_1")[0].checked && !$("#unvisitReleaseDay").val()) {
                        result['isSuccess'] = false;
                        result['info'] = "未上门拜访的私海释放规则天数必填";
                        return result;
                    }
                }
                if ($(this)[0].id == "releaseRule_2") {
                    if ($("#releaseRule_2")[0].checked && !$("#uncapReleaseDay").val()) {
                        result['isSuccess'] = false;
                        result['info'] = "未产生放款的私海释放规则天数必填";
                        return result;
                    }
                }
                if ($(this)[0].id == "releaseRule_3") {
                    if ($("#releaseRule_3")[0].checked && !$("#hadCapedReleaseDay").val()) {
                        result['isSuccess'] = false;
                        result['info'] = "自上次放款，未产生二次放款的私海释放规则天数必填";
                        return result;
                    }
                }
                if ($(this)[0].id == "releaseRule_4") {
                    if ($("#releaseRule_4")[0].checked && !$("#uncrtprjReleaseDay").val()) {
                        result['isSuccess'] = false;
                        result['info'] = "未产生立项的私海释放规则天数必填";
                        return result;
                    }
                }
                if ($(this)[0].id == "receivelimit") {
                    if ($("#receivelimit")[0].checked && !$("#releasedReceiveDay").val()) {
                        result['isSuccess'] = false;
                        result['info'] = "释放公海客户经理再次可以领取时间限制为必填项";
                        return result;
                    }
                }
                if ($(this)[0].id == "receiveRule_1") {
                    if ($("#receiveRule_1")[0].checked && !$("#capDelayDate").val()) {
                        result['isSuccess'] = false;
                        result['info'] = "有放款记录将增加私海时长天数必填";
                        return result;
                    }
                }
                if ($(this)[0].id == "receiveRule_2") {
                    if ($("#receiveRule_2")[0].checked && !$("#crtPrjDelayDate").val()) {
                        result['isSuccess'] = false;
                        result['info'] = "有立项记录增加私海时长天数必填";
                        return result;
                    }
                }
                if ($(this)[0].id == "receiveRule_3") {
                    if ($("#receiveRule_3")[0].checked && !$("#visitRecDelayDate").val()) {
                        result['isSuccess'] = false;
                        result['info'] = "有拜访记录的增加私海时长天数必填";
                        return result;
                    }
                }
                if ($(this)[0].id == "isCanReceive_yes" || $(this)[0].id == "isCanReceive_no") {
                    if ($("#isCanReceive_yes")[0].checked || $("#isCanReceive_no")[0].checked) {
                        return result;
                    }else{
                        result['isSuccess'] = false;
                        result['info'] = "是否支持领取私海为必选项";
                        return result;
                    }
                }
                if(($(this)[0].id == "releaseRule_1" && $("#releaseRule_1")[0].checked) || ($(this)[0].id == "releaseRule_2" && $("#releaseRule_2")[0].checked)
                        || ($(this)[0].id == "releaseRule_3" && $("#releaseRule_3")[0].checked) || ($(this)[0].id == "releaseRule_4" && $("#releaseRule_4")[0].checked)){
                    if ($("#qc_yes")[0].checked || $("#qc_no")[0].checked) {
                        return result;
                    }else{
                        result['isSuccess'] = false;
                        result['info'] = "自动释放条件关系为必选项";
                        return result;
                    }
                }
            }
        });
        return result;
    }

    //QC 选择fun
    function checkQCChange() {
        if(document.getElementById("qc_yes").checked){
            autoRuleQCAndIsOr = 1;
            /*console.log("111111");
           // $("#qc_no").removeClass("l-hidden");

            document.getElementById("qc_no").removeAttribute("checked");
            document.getElementById("qc_no").checked = false;
            console.log("document.getElementById(\"qc_no\").checked = "+document.getElementById("qc_no").checked);
            $("#qc_no").attr("cheched", false);
            $("#qc_no").removeClass("l-checkbox-checked");

            console.log("autoRuleQCAndIsOr == "+autoRuleQCAndIsOr);*/
        }
        if(document.getElementById("qc_no").checked){
            autoRuleQCAndIsOr = 0;
            /*console.log("222222");
            // $("#qc_yes").removeClass("l-hidden");
            document.getElementById("qc_yes").removeAttribute("checked");
            document.getElementById("qc_yes").checked = false;
            console.log("document.getElementById(\"qc_yes\").checked = "+document.getElementById("qc_yes").checked);
            $("#qc_yes").attr("cheched", false);*/
        }
    }

</script>



</body>
</html>
